<template>
	<view>
		<swiper class="detail-swiper" :indicator-dots="true" :autoplay="true" :interval="3000" :duration="1000">
			<swiper-item v-for="banner in pics" :key="banner.id">
				<image :src="banner.pic" mode="scaleToFill"></image>
			</swiper-item>
		</swiper>
		<view class="">
			{{basicInfo.name}}
		</view>
		<!-- <rich-text :nodes="content"></rich-text> -->
		 <view class="content" v-html="content"> 
			
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				basicInfo: {},
				content: '',
				pics: []
			}
		},
		onLoad(options){
			console.log(options);
			this.fetchDetail(options.id)
		},
		methods: {
			fetchDetail(id){
				this.$request('/shop/goods/detail', {
					data: {
						id
					}
				}).then(res=> {
					if (res.data.code === 0) {
						this.basicInfo = res.data.data.basicInfo;
						this.content = res.data.data.content.replace(/<img/gi, "<img style='display:block;width:100%'");
						this.pics = res.data.data.pics;
						uni.setNavigationBarTitle({
							title: this.basicInfo.name
						})
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
.detail{
	width: 750rpx;
	height: 375rpx;
	image{
		width: 750rpx;
		height: 375rpx;
	}
}
</style>
